<?php 
	$conn=@mysqli_connect('localhost','yg1900068','pass123456');
	if($conn==false){
		echo json_encode(['error'=>1,'msg'=>'网络错误，请检查网络连接']);
		exit();
	}
	mysqli_select_db($conn,'yg1900068');
	mysqli_query($conn,'set names utf8');



	if($_POST['act']=='list'){
		$query=mysqli_query($conn,"select * from zx_zixun where 1 order by addtime desc");
		while($row=mysqli_fetch_assoc($query)){
			$row['addtime'] = date("n月j日",$row['addtime']);
			$list[]=$row;
		}
		echo json_encode(['error'=>0,'msg'=>'success','data'=>$list]);
		
	}
	else if($_POST['act']=='list2'){
		$cate=$_POST['cate'];
		$page=$_POST['page'];
		$size=$_POST['size'];
		$start=($page-1)*$size;
		$query=mysqli_query($conn,"select * from zx_zixun where category='$cate' order by addtime desc limit $start,$size");
		while($row=mysqli_fetch_assoc($query)){
			$row['addtime'] = date("n月j日",$row['addtime']);
			$list[]=$row;
		}
		echo json_encode(['error'=>0,'msg'=>'success','data'=>$list]);
		
	}






	mysqli_close($conn);


?>